const express = require("express");
const OrderRouter = express.Router();
const OrderServer = require("../../server/orderServer");
const sendMsg = require("../reqSendResult");
// 添加商户
OrderRouter.post(
  "/addOrder",
  sendMsg.asyncHandler(async (req, res, next) => {
    // 验证参数
    // await addShopValidate(req, res, next);
    return await OrderServer.addOrder(req.body);
  }, "添加订单成功")
);
// 获取订单列表
OrderRouter.get(
  "/getOrderList",
  sendMsg.asyncHandler(async (req, res) => {
    return await OrderServer.getOrder(
      req.query.uid,
      req.query.shopId || undefined,
      req.query.merchandiseId || undefined,
      req.query.page || 1,
      req.query.pageSize || 10,
      req.query.time || undefined,
      req.query.keyword || undefined,
      req.query.orderType || 1
    );
  }, "获取订单列表成功")
);

module.exports = OrderRouter;